package com.hongyi.system.domain.dto;


import com.hongyi.common.framework.validate.AddGroup;
import com.hongyi.common.framework.validate.EditGroup;
import com.hongyi.common.framework.validate.PasswordAuthGroup;
import com.hongyi.common.framework.validate.StatusGroup;
import com.hongyi.common.framework.validate.custom.ValidPassword;
import com.hongyi.common.mybatis.domain.BaseEntity;
import com.hongyi.system.domain.SysUser;
import io.github.linpeilie.annotations.AutoMapper;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

/**
 * 用户信息表
 */
@Data
@EqualsAndHashCode(callSuper = true)
@AutoMapper(target = SysUser.class)
public class SysUserDto extends BaseEntity {

    /**
     * 用户ID
     */
    @NotNull(message = "用户ID不能为空",groups = {EditGroup.class,StatusGroup.class})
    private Long userId;

    /**
     * 部门ID
     */
    private Long deptId;

    /**
     * 用户账号
     */
    @NotBlank(message = "用户账号不能为空", groups = {AddGroup.class} )
    @Size(min = 0, max = 30, message = "用户账号长度不能超过{max}个字符")
    private String userName;

    /**
     * 用户昵称
     */
    @NotBlank(message = "用户昵称不能为空",groups = {AddGroup.class, EditGroup.class})
    @Size(min = 0, max = 30, message = "用户昵称长度不能超过{max}个字符")
    private String nickName;

    /**
     * 用户类型（sys_user系统用户）
     */
    private String userType;

    /**
     * 用户邮箱
     */
    @Size(min = 0, max = 50, message = "邮箱长度不能超过{max}个字符")
    private String email;

    /**
     * 手机号码
     */
    private String phonenumber;

    /**
     * 用户性别（0男 1女 2未知）
     */
    private String sex;

    /**
     * 密码
     */
    @NotBlank(message = "用户账号不能为空", groups = {AddGroup.class, PasswordAuthGroup.class} )
    @ValidPassword(groups = {AddGroup.class, PasswordAuthGroup.class})
    private String password;

    /**
     * 帐号状态（0正常 1停用）
     */
    @NotBlank(message = "用户昵称不能为空",groups = {StatusGroup.class})
    private String status;

    /**
     * 备注
     */
    private String remark;

    /**
     * 角色组
     */
    @NotEmpty(message = "用户角色不能为空", groups = {AddGroup.class, EditGroup.class} )
    private Long[] roleIds;

    /**
     * 岗位组
     */
    private Long[] postIds;

    /**
     * 数据权限 当前角色ID
     */
    private Long roleId;

}